package com.hnkywl.sts.action.sys;

import com.hnkywl.sts.service.sys.CdService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 菜单Action类
 * User: Administrator
 * Date: 13-3-9
 * Time: 下午4:09
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/sys/cd")
public class CdAction extends SimpleActionSupport{
    private CdService cdService;
    //菜单Id
    private Long cdId;

    /**
     * 生成整个菜单树
     */
    @Action("get_cdtree")
    public void getTree() {
        renderJson(cdService.getTreeJson());
    }

    /**
     * 生成整个菜单树第二种Json形式
     */
    @Action("get_cdtree2")
    public void getTree2() {
        renderJson(cdService.getTreeJson2());
    }

    /**
     * 获得某个菜单的所有页面元素
     */
    @Action("get_ymys")
    public void getYmys() {
        renderJson(cdService.getYmys(cdId));
    }

    /**
     * 获得某个菜单的所有功能操作
     */
    @Action("get_gncz")
    public void getGncz() {
        renderJson(cdService.getGncz(cdId));
    }

    @Autowired
    public void setCdService(CdService cdService) {
        this.cdService = cdService;
    }

    public Long getCdId() {
        return cdId;
    }

    public void setCdId(Long cdId) {
        this.cdId = cdId;
    }
}
